class Solution {
public:
    vector<int> GetLeastNumbers_Solution(vector<int> input, int k) {
        int n = input.size();
        vector<int> res;
        for(int i = 0; i < k; i++) {
            int minn = input[i];
            int mini = i;
            for(int j = i; j < n; j++) {
                if(input[j] < minn) {
                    minn = input[j];
                    mini = j;
                }
            }
            res.push_back(input[mini]);
            swap(input[i], input[mini]);           
        }
        return res;
    }
};